/<template>
  <div class="adduser">
      用户名:<input type="text" v-model="user.username">
      昵称:<input type="text" v-model="user.nickname">
      电话:<input type="text" v-model="user.tel">
      年龄:<input type="text" v-model="user.age">
      <button @click="add">提交</button>
  </div>
</template>

<script>
import {add_user} from "../../api/api"

export default {
    data () {
        return {
            user:{
                username:"",
                nickname:"",
                tel:"",
                age:""
            }
        }
    },
    methods: {
        async add(){
            let {data}=await add_user(this.user)
            if(data.code==="1001"){
                this.$router.push('/home/user')
            }
        }
    }
}
</script>

<style>

</style>